package exception;

public class ThrowsDemo {
    public static void main(String[] args) {
        Student ZS = new Student();
        try{
            ZS.setAge(1000);
        }catch (IllegalAgeException e){
            e.printStackTrace();//打印错误栈跟踪信息
//            System.out.println(e.getMessage());//获取错误信息并输出
        }

        System.out.println("此人年龄为"+ZS.getAge()+"岁");
    }
}
